import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:m/features/pages/bible/model/bible_model.dart';
import 'package:m/plugins/star_provider/index.dart';

class BibleBottom extends StatelessWidget {
  final Color? bgColor;
  const BibleBottom({super.key , this.bgColor });
  @override
  Widget build(BuildContext context) {
    double bottom = MediaQuery.of(context).padding.bottom;
    final bibleModel = context.watch<BibleModel>();
    bottom = bibleModel.isSelect ? bottom + 12 : -100.0;
    final textColor = context.isDarkMode ? Colors.white : Colors.black;
    return AnimatedPositioned( 
          left: 0,
          right: 0,
          bottom: bottom + 12, 
          duration: const Duration(milliseconds: 300),
          child: Padding(
            padding: const EdgeInsets.only(left: 8.0,right: 8.0),
            child: Container(
              // height: 46,rrr
              decoration: BoxDecoration(
              color: bgColor,
              borderRadius: const BorderRadius.all( Radius.circular(12)),
              border: Border.all(color: Colors.grey,width: 0.5),
             ),
             child: DefaultTextStyle(
               style:   TextStyle(fontSize: 12,color:textColor),
               child: Row(
                mainAxisAlignment: MainAxisAlignment.spaceAround,
                children: [
                  Column(children: [
                    IconButton(onPressed: (){
                      bibleModel.copy();
                    }, icon:const Icon(Icons.copy )),
                    const Text('复制经文',)
                  ],),
                   Column(children: [
                    IconButton(onPressed: (){
                      bibleModel.addBookmark();
                    }, icon:const Icon(Icons.bookmark_add_outlined )),
                    const Text('加入书签' )
                  ],),
                  Column(children: [
                    IconButton(onPressed: (){
                      bibleModel.clearSelect();
                    }, icon:const Icon(Icons.clear_all_outlined )),
                    const Text('清空选择')
                  ],),
                ],
               ),
             ),
            ),
          ),
        );
  }
}